import datetime
import time
import win32api

import psutil


def searchProcess(pro_name='oriDE.exe'):
    for i in psutil.process_iter():
        if pro_name == i.name():
            return True
    return False


def calProcess(pro_name='oriDE.exe'):
    time_begin = time.time()
    while searchProcess(pro_name):
        time.sleep(1)
    time_end = time.time()
    during_time = int(time_end - time_begin)
    hour = during_time // 3600
    during_time -= (hour * 3600)
    minute = during_time // 60
    during_time -= (minute * 60)
    second = during_time
    return [hour, minute, second]


if __name__ == "__main__":
    win32api.ShellExecute(0, 'open', "D:\\team\\steamapps\\common\\Ori DE\\oriDE.exe", '', '', 1)
    if searchProcess():
        li1 = calProcess()
        for i in li1:
            print(i)
